﻿using System;
using ch02.binary.module;
using ch02.binary.type;

namespace ch02.binary
{
    using TypeIdx = UInt32;
    using FuncIdx = UInt32;
    using TableIdx = UInt32;
    using MemIdx = UInt32;
    using GlobalIdx = UInt32;
    using LocalIdx = UInt32;
    using LabelIdx = UInt32;
    using MemType = Limits;

    public struct Module
    {
        internal uint Magic; //魔数
        internal uint Version; // 版本号
        internal CustomSec[] CustomSecs; //自定义段
        internal FuncType[] TypeSec; //
        internal Import[] ImportSec; //导入段
        internal TypeIdx[] FuncSec; //函数段
        internal TableType[] TableSec; //表段
        internal MemType[] MemSec; //内存段
        internal Global[] GlobalSec; //全局段
        internal Export[] ExportSec; //导出段
        internal unsafe FuncIdx* StartSec; //起始段
        internal Elem[] ElemSec; //元素段
        internal Code[] CodeSec; //代码段
        internal Data[] DataSec; //数据段
    }
}